package com.itcast.utils

import org.apache.spark.Partition
import org.apache.spark.sql.{DataFrame, SQLContext, SaveMode}

object MysqlHandler {
    def save2db(resultDF:DataFrame,tbName:String,partition:Int = 4 ): Unit ={
      resultDF.coalesce(partition).write.mode(SaveMode.Overwrite).jdbc(
        ConfigHandler.url,
        tbName,
        ConfigHandler.dbProper
      )
    }
}
